package com.db.gffxo.epi.test;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import junit.framework.TestCase;
import com.db.gffxo.epi.domain.EventDetail;
import com.db.gffxo.epi.repository.EventDetailDaoGen;


public class EventDetailTestGen extends TestCase {

private DriverManagerDataSource dataSource;
private EventDetailDaoGen dao;
private EventDetail EventDetail;
	public void setUp() {
		dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
		dataSource.setUrl("jdbc:mysql:///epi");
		dataSource.setUsername("epi");
		dataSource.setPassword("epiepi");
		dao= new EventDetailDaoGen();
		dao.setDataSource(dataSource);

		EventDetail = new EventDetail();
		EventDetail.setDetailId(666);
		EventDetail.setEventId(666);
		EventDetail.setMessage("Message");
	}

	public void testInsertAndGet () {

		dao.insert(EventDetail);

		List dbaEventDetails = dao.getEventDetail();

		EventDetail dbaEventDetail = (EventDetail) dbaEventDetails.get(0);

		assertEquals("DetailId",EventDetail.getDetailId(),dbaEventDetail.getDetailId());
		assertEquals("EventId",EventDetail.getEventId(),dbaEventDetail.getEventId());
		assertEquals("Message",EventDetail.getMessage(),dbaEventDetail.getMessage());
	}

}